#pragma once
#include "precompiled.h"
#include "RenderManager.h"
#include "Geometry_Defines.h"

class hkMovingRBCollectorPhantom;

enum eParticleBehavior{ LINEAR, OBRIT, CONESPRAY, EXPLODE };

/*typedef struct{
	glm::vec3 start, end;
	float acceleration, maxVelocity;
	bool noisy;
}behavior_Linear;

typedef struct{
	glm::vec3 center;
	float maxLifetime, acceleration, maxVelocity, radius, angle;
	bool noisy;
}behavior_Orbit;

typedef struct{
	glm::vec3 origin, direction;
	float maxLifetime, acceleration, maxVelocity, radius;
	bool noisy;
}behavior_ConeSpray;

typedef struct{
	glm::vec3 origin;
	float maxLifetime, acceleration, maxVelocity, maxDistance;
	bool noisy;
}behavior_Explode;*/

typedef struct{
	eParticleBehavior behavior_type;
	glm::vec3 origin, start, end;
	float maxLifetime, acceleration, maxVelocity, maxDistance, radius, angle;
	bool noisy,physical;
}ParticleBehavior;

// Strides:
//	pos to pos: 2xGLM::Vec3 + 1xBool + 3xGlFloat.
//
//
typedef struct{
	bool alive;
	GLfloat alpha, velocity, acceleration;
	glm::vec3 pos, rot, scale;
	glm::vec3 origin, start, end;
	hkMovingRBCollectorPhantom* phantom;
}Particle;

typedef struct{
	int numAlive;
	Particle particle[32];
	Vertex_P position_buffer[32];
	ParticleBehavior behavior;
}ParticlePool_32;

typedef struct{
	int numAlive;
	Particle particle[64];
	Vertex_P position_buffer[64];
	ParticleBehavior behavior;
}ParticlePool_64;

typedef struct{
	int numAlive;
	Particle particle[128];
	Vertex_P position_buffer[128];
	ParticleBehavior behavior;
}ParticlePool_128;

typedef struct{
	int numAlive;
	Particle particle[256];
	Vertex_P position_buffer[256];
	ParticleBehavior behavior;
}ParticlePool_256;

typedef struct{
	int numAlive;
	Particle particle[512];
	Vertex_P position_buffer[512];
	ParticleBehavior behavior;
}ParticlePool_512;

enum PoolSize{ PS32, PS64, PS128, PS256, PS512 };
typedef struct{
	ParticlePool_32* pool32;
	ParticlePool_128* pool128;
	ParticlePool_256* pool256;
	ParticlePool_512* pool512;
	PoolSize size;
	RenderTicket rticket;
	std::string key;
}ParticlePool;
